﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
using AcctrueWMS.Foundation.Web;
namespace AcctrueWMS.Web.Exec
{
    public partial class Report : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string rdlc = Request["rdlc"];
                if (Runtime.Cache[rdlc] != null)
                {                    
                    DataTable dt =Runtime.Cache[rdlc] as DataTable;
                    ReportDataSource dataSource = new ReportDataSource(rdlc, dt);
                    rvStockInfo.LocalReport.ReportPath = Server.MapPath("~/Reports/" + rdlc + ".rdlc");
                    if (Request["showReportHeader"] == "false")
                    {
                        rvStockInfo.Height = 400;
                        rvStockInfo.ShowToolBar = false;
                    }
                    string strExportFileName = Request["exportFileName"];
                    if (!string.IsNullOrEmpty(strExportFileName))
                    {
                        rvStockInfo.LocalReport.DisplayName = strExportFileName + DateTime.Now.Date.ToString("yyyy-MM-dd");
                    }   
                    rvStockInfo.LocalReport.DataSources.Clear();
                    rvStockInfo.LocalReport.DataSources.Add(dataSource);
                    
                }
            }
        }
    }
}